package com.rc.saas.tenant.common.enums;


/**
 * Create by Yang on 2021/12/18
 */
public enum JunStopReasonEnum {

    JunStopReasonEnum_00(0,"人工终止"),
    JunStopReasonEnum_01(1,"自动充满"),
    JunStopReasonEnum_02(2,"后台终止"),
    JunStopReasonEnum_03(3,"故障终止");

    /**
     * 解析code
     *
     * @param code
     * @return
     */
    //public static String getElecPileStopReasonResult(String code) {
    //    Integer intCode = Integer.valueOf(code);
    //    Class<JunStopReasonEnum> enumClass = JunStopReasonEnum.class;
    //    for (JunStopReasonEnum stopReasonEnum : enumClass.getEnumConstants()) {
    //        if (intCode == stopReasonEnum.getCode()) {
    //            return stopReasonEnum.getMsg();
    //        }
    //    }
    //    return "JUN该停止方式未知:" + intCode;
    //
    //}

    public static String getElecPileStopReasonResult(Integer code) {
        if (code == null){
            return  "jun null";
        }
        Class<JunStopReasonEnum> enumClass = JunStopReasonEnum.class;
        for (JunStopReasonEnum stopReasonEnum : enumClass.getEnumConstants()) {
            if (code == stopReasonEnum.getCode()) {
                return stopReasonEnum.getMsg();
            }
        }
        return "JUN该停止方式未知:" + code;

    }

    private Integer code;

    private String msg;

    JunStopReasonEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }}
